package pandora.bo.login;

import pandora.data.IAccountDAO;
import pandora.data.ICustomerDAO;
import pandora.data.IStoreDAO;
import pandora.data.mysql.JDBCAccountDAO;
import pandora.data.mysql.JDBCCustomerDAO;
import pandora.data.mysql.JDBCStoreDAO;
import pandora.dto.CustomerDTO;
import pandora.dto.StoreDTO;

public class DBLogin {
	
	private IAccountDAO account;
	private ICustomerDAO customer;
	private IStoreDAO store;
	
	public DBLogin(){
		account = new JDBCAccountDAO();
		customer = new JDBCCustomerDAO();
		store = new JDBCStoreDAO();
	}
	
	public boolean login(String usr, String pwd){
		return account.userValid(usr, pwd);
	}
	
	public boolean verifyStore(String usr){
		return store.isStore(usr);
	}
	
	public boolean verifyCustomer(String usr){
		return customer.isCustomer(usr);
	}
	
	public StoreDTO obtainStore(String usr){
		return store.selectStoreByAccount(usr);
	}
	
	public CustomerDTO obtainCustomer(String usr){
		return customer.selectCustomerByAccount(usr);
	}
}
